package com.lianzhihui.romeex.ui.trade.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lianzhihui.romeex.R;
import com.lianzhihui.romeex.bean.ConversionIndexBean;

import java.util.List;

/**
 * @ProjectName: romeex
 * @Package: com.lianzhihui.romeex.ui.trade.adapter
 * @ClassName: ExtractFragmentAdapter
 * @Description: java类作用描述
 * @Author: zhanghong
 * @CreateDate: 2020/10/30 17:38
 * @UpdateUser: 更新者：
 * @UpdateDate: 2020/10/30 17:38
 * @UpdateRemark: 更新说明：
 * @Version: 1.0
 */
public class ExchangeInPopWindowAdapter extends BaseQuickAdapter<ConversionIndexBean.ConvertInCoinListBean, BaseViewHolder> {

    Context mContext;
    int selectStrIndex = -1;

    public void setSelectIndex(int selectStrIndex) {
        this.selectStrIndex = selectStrIndex;
    }

    public ExchangeInPopWindowAdapter(@Nullable Context mContext, @Nullable List<ConversionIndexBean.ConvertInCoinListBean> data) {
        super(R.layout.item_exchange_pop, data);
        this.mContext = mContext;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, ConversionIndexBean.ConvertInCoinListBean item) {
//        if (item.getCoinName().equals("RET")) {
//            helper.setImageResource(R.id.iv_icon, R.drawable.icon_logo_ret_5);
//        } else if (item.getCoinName().equals("RUSD")) {
//            helper.setImageResource(, R.drawable.icon_logo_rusd_5);
//        } else {
//            helper.setImageResource(R.id.iv_icon, R.drawable.icon_logo_usdt);
//        }
        ImageView view = helper.getView(R.id.iv_icon);
        Glide.with(mContext).load(item.getIcon()).into(view);
        helper.setText(R.id.tv_input, item.getCoinNameAlias());
        if (item.getSort() == selectStrIndex) {
            helper.setVisible(R.id.iv_select, true);
        } else {
            helper.setVisible(R.id.iv_select, false);
        }
    }
}
